3.1080 \(\int \frac{(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx\)

Optimal. Leaf size=129 \[ \frac{x \left (-3 i c^2 d+c^3+3 c d^2+3 i d^3\right )}{2 a}-\frac{d^2 (c+3 i d) \tan (e+f x)}{2 a f}+\frac{d^2 (-d+3 i c) \log (\cos (e+f x))}{a f}+\frac{(-d+i c) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))} \]

[Out]

((c^3 - (3*I)*c^2*d + 3*c*d^2 + (3*I)*d^3)*x)/(2*a) + (((3*I)*c - d)*d^2*Log[Cos[e + f*x]])/(a*f) - ((c + (3*I
)*d)*d^2*Tan[e + f*x])/(2*a*f) + ((I*c - d)*(c + d*Tan[e + f*x])^2)/(2*f*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.155703, antiderivative size = 129, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.107, Rules used = {3550, 3525, 3475} \[ \frac{x \left (-3 i c^2 d+c^3+3 c d^2+3 i d^3\right )}{2 a}-\frac{d^2 (c+3 i d) \tan (e+f x)}{2 a f}+\frac{d^2 (-d+3 i c) \log (\cos (e+f x))}{a f}+\frac{(-d+i c) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x]),x]

[Out]

((c^3 - (3*I)*c^2*d + 3*c*d^2 + (3*I)*d^3)*x)/(2*a) + (((3*I)*c - d)*d^2*Log[Cos[e + f*x]])/(a*f) - ((c + (3*I
)*d)*d^2*Tan[e + f*x])/(2*a*f) + ((I*c - d)*(c + d*Tan[e + f*x])^2)/(2*f*(a + I*a*Tan[e + f*x]))

Rule 3550

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((b
*c - a*d)*(c + d*Tan[e + f*x])^(n - 1))/(2*a*f*(a + b*Tan[e + f*x])), x] + Dist[1/(2*a^2), Int[(c + d*Tan[e +
f*x])^(n - 2)*Simp[a*c^2 + a*d^2*(n - 1) - b*c*d*n - d*(a*c*(n - 2) + b*d*n)*Tan[e + f*x], x], x], x] /; FreeQ
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[n, 1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \frac{(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx &=\frac{(i c-d) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))}+\frac{\int (c+d \tan (e+f x)) \left (a \left (c^2-3 i c d+2 d^2\right )-a (c+3 i d) d \tan (e+f x)\right ) \, dx}{2 a^2}\\ &=\frac{\left (c^3-3 i c^2 d+3 c d^2+3 i d^3\right ) x}{2 a}-\frac{(c+3 i d) d^2 \tan (e+f x)}{2 a f}+\frac{(i c-d) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))}-\frac{\left ((3 i c-d) d^2\right ) \int \tan (e+f x) \, dx}{a}\\ &=\frac{\left (c^3-3 i c^2 d+3 c d^2+3 i d^3\right ) x}{2 a}+\frac{(3 i c-d) d^2 \log (\cos (e+f x))}{a f}-\frac{(c+3 i d) d^2 \tan (e+f x)}{2 a f}+\frac{(i c-d) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))}\\ \end{align*}

Mathematica [A]  time = 2.47152, size = 236, normalized size = 1.83 \[ \frac{\sec (e+f x) (\cos (f x)+i \sin (f x)) \left (2 f x \left (-3 i c^2 d+c^3+3 c d^2+3 i d^3\right ) (\cos (e)+i \sin (e))-4 d^2 f x (3 c+i d) (\cos (e)+i \sin (e))+2 i d^2 (3 c+i d) (\cos (e)+i \sin (e)) \log \left (\cos ^2(e+f x)\right )+4 d^2 (3 c+i d) (\cos (e)+i \sin (e)) \tan ^{-1}(\tan (f x))+(c+i d)^3 (\sin (e)+i \cos (e)) \cos (2 f x)+(c+i d)^3 (\cos (e)-i \sin (e)) \sin (2 f x)+4 d^3 (\tan (e)-i) \sin (f x) \sec (e+f x)\right )}{4 f (a+i a \tan (e+f x))} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x]),x]

[Out]

(Sec[e + f*x]*(Cos[f*x] + I*Sin[f*x])*(-4*(3*c + I*d)*d^2*f*x*(Cos[e] + I*Sin[e]) + 2*(c^3 - (3*I)*c^2*d + 3*c
*d^2 + (3*I)*d^3)*f*x*(Cos[e] + I*Sin[e]) + 4*(3*c + I*d)*d^2*ArcTan[Tan[f*x]]*(Cos[e] + I*Sin[e]) + (2*I)*(3*
c + I*d)*d^2*Log[Cos[e + f*x]^2]*(Cos[e] + I*Sin[e]) + (c + I*d)^3*Cos[2*f*x]*(I*Cos[e] + Sin[e]) + (c + I*d)^
3*(Cos[e] - I*Sin[e])*Sin[2*f*x] + 4*d^3*Sec[e + f*x]*Sin[f*x]*(-I + Tan[e])))/(4*f*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Maple [B]  time = 0.03, size = 288, normalized size = 2.2 \begin{align*}{\frac{-i{d}^{3}\tan \left ( fx+e \right ) }{af}}-{\frac{3\,\ln \left ( \tan \left ( fx+e \right ) -i \right ){c}^{2}d}{4\,af}}+{\frac{5\,\ln \left ( \tan \left ( fx+e \right ) -i \right ){d}^{3}}{4\,af}}-{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( fx+e \right ) -i \right ){c}^{3}}{af}}-{\frac{{\frac{9\,i}{4}}\ln \left ( \tan \left ( fx+e \right ) -i \right ) c{d}^{2}}{af}}+{\frac{{\frac{3\,i}{2}}{c}^{2}d}{af \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{{\frac{i}{2}}{d}^{3}}{af \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{{c}^{3}}{2\,af \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{3\,c{d}^{2}}{2\,af \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{3\,\ln \left ( \tan \left ( fx+e \right ) +i \right ){c}^{2}d}{4\,af}}-{\frac{\ln \left ( \tan \left ( fx+e \right ) +i \right ){d}^{3}}{4\,af}}+{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( fx+e \right ) +i \right ){c}^{3}}{af}}-{\frac{{\frac{3\,i}{4}}\ln \left ( \tan \left ( fx+e \right ) +i \right ) c{d}^{2}}{af}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x)

[Out]

-I/f/a*d^3*tan(f*x+e)-3/4/f/a*ln(tan(f*x+e)-I)*c^2*d+5/4/f/a*ln(tan(f*x+e)-I)*d^3-1/4*I/f/a*ln(tan(f*x+e)-I)*c
^3-9/4*I/f/a*ln(tan(f*x+e)-I)*c*d^2+3/2*I/f/a/(tan(f*x+e)-I)*c^2*d-1/2*I/f/a/(tan(f*x+e)-I)*d^3+1/2/f*c^3/a/(t
an(f*x+e)-I)-3/2/f/a/(tan(f*x+e)-I)*c*d^2+3/4/f/a*ln(tan(f*x+e)+I)*c^2*d-1/4/f/a*ln(tan(f*x+e)+I)*d^3+1/4*I/f/
a*ln(tan(f*x+e)+I)*c^3-3/4*I/f/a*ln(tan(f*x+e)+I)*c*d^2

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.70215, size = 518, normalized size = 4.02 \begin{align*} \frac{{\left (2 \, c^{3} - 6 i \, c^{2} d + 18 \, c d^{2} + 10 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} +{\left (i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + 9 \, d^{3} +{\left (2 \, c^{3} - 6 i \, c^{2} d + 18 \, c d^{2} + 10 i \, d^{3}\right )} f x\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - 4 \,{\left ({\left (-3 i \, c d^{2} + d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (-3 i \, c d^{2} + d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{4 \,{\left (a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/4*((2*c^3 - 6*I*c^2*d + 18*c*d^2 + 10*I*d^3)*f*x*e^(4*I*f*x + 4*I*e) + I*c^3 - 3*c^2*d - 3*I*c*d^2 + d^3 + (
I*c^3 - 3*c^2*d - 3*I*c*d^2 + 9*d^3 + (2*c^3 - 6*I*c^2*d + 18*c*d^2 + 10*I*d^3)*f*x)*e^(2*I*f*x + 2*I*e) - 4*(
(-3*I*c*d^2 + d^3)*e^(4*I*f*x + 4*I*e) + (-3*I*c*d^2 + d^3)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))
/(a*f*e^(4*I*f*x + 4*I*e) + a*f*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [A]  time = 4.08401, size = 282, normalized size = 2.19 \begin{align*} \frac{2 d^{3} e^{- 2 i e}}{a f \left (e^{2 i f x} + e^{- 2 i e}\right )} + \frac{d^{2} \left (3 i c - d\right ) \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac{\left (\begin{cases} c^{3} x e^{2 i e} + \frac{i c^{3} e^{- 2 i f x}}{2 f} - 3 i c^{2} d x e^{2 i e} - \frac{3 c^{2} d e^{- 2 i f x}}{2 f} + 9 c d^{2} x e^{2 i e} - \frac{3 i c d^{2} e^{- 2 i f x}}{2 f} + 5 i d^{3} x e^{2 i e} + \frac{d^{3} e^{- 2 i f x}}{2 f} & \text{for}\: f \neq 0 \\x \left (c^{3} e^{2 i e} + c^{3} - 3 i c^{2} d e^{2 i e} + 3 i c^{2} d + 9 c d^{2} e^{2 i e} - 3 c d^{2} + 5 i d^{3} e^{2 i e} - i d^{3}\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i e}}{2 a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**3/(a+I*a*tan(f*x+e)),x)

[Out]

2*d**3*exp(-2*I*e)/(a*f*(exp(2*I*f*x) + exp(-2*I*e))) + d**2*(3*I*c - d)*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f)
 + Piecewise((c**3*x*exp(2*I*e) + I*c**3*exp(-2*I*f*x)/(2*f) - 3*I*c**2*d*x*exp(2*I*e) - 3*c**2*d*exp(-2*I*f*x
)/(2*f) + 9*c*d**2*x*exp(2*I*e) - 3*I*c*d**2*exp(-2*I*f*x)/(2*f) + 5*I*d**3*x*exp(2*I*e) + d**3*exp(-2*I*f*x)/
(2*f), Ne(f, 0)), (x*(c**3*exp(2*I*e) + c**3 - 3*I*c**2*d*exp(2*I*e) + 3*I*c**2*d + 9*c*d**2*exp(2*I*e) - 3*c*
d**2 + 5*I*d**3*exp(2*I*e) - I*d**3), True))*exp(-2*I*e)/(2*a)

________________________________________________________________________________________

Giac [A]  time = 2.02843, size = 251, normalized size = 1.95 \begin{align*} -\frac{\frac{4 i \, d^{3} \tan \left (f x + e\right )}{a} - \frac{{\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a} + \frac{{\left (i \, c^{3} + 3 \, c^{2} d + 9 i \, c d^{2} - 5 \, d^{3}\right )} \log \left (-i \, \tan \left (f x + e\right ) - 1\right )}{a} + \frac{-i \, c^{3} \tan \left (f x + e\right ) - 3 \, c^{2} d \tan \left (f x + e\right ) - 9 i \, c d^{2} \tan \left (f x + e\right ) + 5 \, d^{3} \tan \left (f x + e\right ) - 3 \, c^{3} - 3 i \, c^{2} d - 3 \, c d^{2} - 3 i \, d^{3}}{a{\left (\tan \left (f x + e\right ) - i\right )}}}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

-1/4*(4*I*d^3*tan(f*x + e)/a - (I*c^3 + 3*c^2*d - 3*I*c*d^2 - d^3)*log(tan(f*x + e) + I)/a + (I*c^3 + 3*c^2*d
+ 9*I*c*d^2 - 5*d^3)*log(-I*tan(f*x + e) - 1)/a + (-I*c^3*tan(f*x + e) - 3*c^2*d*tan(f*x + e) - 9*I*c*d^2*tan(
f*x + e) + 5*d^3*tan(f*x + e) - 3*c^3 - 3*I*c^2*d - 3*c*d^2 - 3*I*d^3)/(a*(tan(f*x + e) - I)))/f